package com.registtools.controller;

import com.registtools.service.ChangeCouresService;
import com.registtools.service.impl.PushMessageImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author czy
 */
@RestController
@RequestMapping(value = "/api")
public class ChangeCouresController {

    @Autowired
    private ChangeCouresService changeCouresService;

    @Autowired
    PushMessageImpl pushMessage;
    /**
     * 场景：缴费-调课-退费
     *缴费：一键缴费接口->form-data格式
     * */
    @PostMapping("/pay")
    public String changeCouresCheck(@RequestParam("studentid") String studentid,@RequestParam("classid") String classid){
        return  changeCouresService.changeCourseCheck(studentid,classid);
    }
    @GetMapping("/test")
    public Map<String,Object> getCountClasses(){
        Map<String, Object> repMap = new HashMap<>();
        repMap.put("code", 200);
        repMap.put("message","操作成功");
        repMap.put("data",pushMessage.getCountClasses());
        return repMap;
    }
    @GetMapping("/str")
    public String pushMsg(){
        return pushMessage.pushMsg();
    }
}
